print('1.计算1累加到4的和')
i = 1
s = 0
while i < 5:
    s += i
    i += 1
print(s)
print()

print('2,计算1加到100的偶数和')
i = 2
s = 0
while i <= 100:
    s += i
    i += 2
print(s)
print()

print('3,计算1加到100的偶数和')
i = 0
sum = 0
for i in range(1,101):
    if i % 2 == 0:
        sum += i
    else:
        i += 2
print(sum)
print()

print("4,for-in的使用")
for item in 'python':
    print(item, end=' ')

print('5.for-in遍历100~999之间的水仙花数')
item = 100
for item in range(100,1000):
    ge = item % 10
    shi = item // 10 % 10
    bai = item // 100
    if (ge ** 3 + shi ** 3 + bai ** 3) == item:
        print(item)
    else:
        item += 1